package com.anxin.act.task.web;

import com.anxin.act.task.entity.ViewRuTask;
import com.anxin.act.task.service.ActChannelService;
import com.anxin.act.task.dto.AdjustNodeDTO;
import com.anxin.act.task.vo.ChannelVo;
import com.anxin.act.task.vo.TaskVo;
import com.anxin.framework.aspectj.lang.annotation.Log;
import com.anxin.framework.aspectj.lang.enums.BusinessType;
import com.anxin.framework.web.controller.BaseController;
import com.anxin.framework.web.entity.AjaxResult;
import com.anxin.framework.web.page.TableDataInfo;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 流程疏导
 * @author: liuxiangyu
 * @date: 2020/5/18 14:20
 */
//@Api(tags = "流程疏导")
@RestController
@RequestMapping("/act/channel")
public class ActChannelController extends BaseController {

    @Autowired
    private ActChannelService actChannelService;
    /**
     * 查询用户待办
     */
    //@ApiOperation(value ="查询用户待办")
    @GetMapping("list")
    @Log(title = "查询用户待办", businessType = BusinessType.LIST)
    public TableDataInfo<ViewRuTask> list(TaskVo taskVo){
        return getDataTable(actChannelService.list(taskVo));
    }

    /**
     * 分配用户
     * @param channelVo
     * @return
     */
    //@ApiOperation(value = "分配用户")
    @PostMapping("channelTask")
    @Log(title = "分配用户", businessType = BusinessType.UPDATE)
    public AjaxResult channelTask(@RequestBody ChannelVo channelVo) {
        actChannelService.channelTask(channelVo);
        return AjaxResult.success();
    }

    /**
     * 查询流程全部节点
     * @return
     */
    //@ApiOperation(value = "查询流程全部节点")
    @GetMapping("getActivityList/{taskId}")
    @Log(title = "查询流程全部节点", businessType = BusinessType.LIST)
    public AjaxResult getActivityList(@PathVariable("taskId") String taskId){
        return AjaxResult.success(actChannelService.getActivityList(taskId));
    }



    /**
     * 重新调整节点
     * @param adjustNodeDTO
     * @return
     */
    //@ApiOperation(value = "重新调整节点前校验")
    @PostMapping("submitAdjustNodeCheck")
    @Log(title = "重新调整节点前校验", businessType = BusinessType.UPDATE)
    public AjaxResult submitAdjustNodeCheck(@RequestBody AdjustNodeDTO adjustNodeDTO){
        return actChannelService.submitAdjustNodeCheck(adjustNodeDTO);
    }



    /**
     * 重新调整节点
     * @param adjustNodeDTO
     * @return
     */
    //@ApiOperation(value = "重新调整节点")
    @PostMapping("submitAdjustNode")
    @Log(title = "重新调整节点", businessType = BusinessType.UPDATE)
    public AjaxResult submitAdjustNode(@RequestBody AdjustNodeDTO adjustNodeDTO){
        actChannelService.submitAdjustNode(adjustNodeDTO);
        return AjaxResult.success();
    }
}
